package com.zqxq.lottery.mq;

import com.zqxq.lottery.common.constant.HuaYangConstant;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 死信接收处理消费者
  */
@Component
@RabbitListener(queues = HuaYangConstant.DEFAULT_REPEAT_TRADE_QUEUE_NAME)
public class TradeProcessor {

    @Autowired
    private Sender sender;

    @RabbitHandler
    public void process(String content) {
        DLXMessage message = JSONUtils.toBean(content, DLXMessage.class);
        sender.send(message.getQueueName(), message.getContent());
    }
}
